package com.gee.spring.boot.oauth2.common.util.http;


import cn.hutool.json.JSONUtil;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * desc:
 *
 * @author gee
 * @date 2020/04/01 22:19
 */
public class ResponseUtil {

    public static void writeJson(HttpServletResponse response, Object o) throws IOException {
        response.setContentType("application/json;charset=UTF-8");
        PrintWriter writer = response.getWriter();
        writer.write(JSONUtil.toJsonStr(o));
        writer.flush();
        writer.close();

    }
}
